#include <vector>
#include <utility>
#include <exception>
#include "NDArray.h"

using namespace std;

class Sampler
{
	protected:
		vector< pair<int, int> > pattern;
		unsigned int maxRadius;
	
	public:

		class InvalidIndex : public exception
		{
			virtual const char* what() const throw();
		};

		Sampler( const unsigned int rings, const unsigned int *ringsRadius, const unsigned int *samplesPerRing );

		void operator()( const CVGreyc::NDArray::CArray<double> &data,
				 const unsigned int centerX,
				 const unsigned int centerY,
				 CVGreyc::NDArray::CArray<double> &result ) const throw(Sampler::InvalidIndex);
		void operator()( const CVGreyc::NDArray::CArray<double> &data,
				 const CVGreyc::NDArray::CArray<unsigned int> &xy_,
				 CVGreyc::NDArray::CArray<double> &result ) const throw(Sampler::InvalidIndex);
		void operator()( const CVGreyc::NDArray::CArray<double> &data,
				 CVGreyc::NDArray::CArray<double> &result ) const;

		unsigned int getXRes( const CVGreyc::NDArray::CArray<double> &data ) const;
		unsigned int getYRes( const CVGreyc::NDArray::CArray<double> &data ) const;
		unsigned int nbSamples() const;

};
